package org.finjic.context;

import org.finjic.annotated.processor.AnnotationProcessor;
import org.finjic.entity.BeanDefinition;
import org.finjic.factory.BeanFactory;
import org.finjic.factory.BeanFactoryImpl;

import java.util.Set;

/**
 * User: Taras
 * Date: 04.11.12
 * Time: 13:27
 */
public class AnnotationBasedApplicationContext extends AbstractApplicationContext {
    Set<BeanDefinition> beanDefinitions;

    public AnnotationBasedApplicationContext(String configFileName) {
        AnnotationProcessor processor = new AnnotationProcessor(configFileName);
        beanDefinitions = processor.processConfigFile();
    }

    @Override
    protected BeanFactory getBeanFactory() {
        return new BeanFactoryImpl(beanDefinitions);
    }
}
